home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 405_01 / flexpp / flexpp1d.man < prev    next >
Encoding:
Text File  |  1993-05-30  |  16.9 KB  |  244 lines

  1. %          %Z% %M% %Y% %Q% %I% %E% %U% (%F%)
  2. %         
  3. %          Nom du Fichier :     bison++.dman
  4. %          Titre :         bison++ man page of modifiactions
  5. %          Auteur:        coetmeur@icdc.fr        
  6. %          Date de creation :    3/3/93
  7. %         
  8. %          Description :
  9. %             Document de reference : see bison.1
  10. %             Objet : present difference from bison 1.19 (standard)
  11. %             and bison++ from which it has been made
  12. %         
  13. %          
  14. %          historique :
  15. %          |>date<|    |>auteur<|    |>objet<|
  16. %         
  17. % header NOM SECTION DATE AUTEUR DOMAINE 
  18. :HEADER FLEX++ 1 "3/3/93" "GNU and RDT" "COMMANDS"
  19. :SECTION "NAME"
  20.     flex++ - generate a scanner in c or c++..
  21. :SECTION "SYNOPSIS"
  22.     "scanner++" ["-bcFfdIiLpsTtv?"] ["-C"["e"]["m"|"f"|"F"]] ["-a"<tmp-directory>]  ["-o"<outfile>] ["-g"<include-pathname>] ["-h"[<headerfile>]] ["-S"<skeleton>] ["-H"<header-skeleton>]  <grammar-file>...
  23.  
  24. :SECTION "DESCRIPTION"
  25.     Generate a scanner. Based on "flex" version 2.3.7. See "flex"(1) and "flexdoc"(1) for details of main functionality. Only changes are reported here.
  26.     You now generate a C++ class if you are compiling with a C++ compiler. A generated header can be generated, and is made from a skeleton-header. The code skeleton is also more adaptable. It permit you to modify much things only by changing the two skeletons.
  27.     In plain C, the "flex++" is compatible with standard "flex".
  28.     If no header is generated, it is in fact merged, instead of included.
  29. :SECTION "OPTIONS"
  30.     -{"-a" <tmp-directory>} Set directory of temp files .
  31.     -{"-S"<skeleton>} Set filename of code skeleton. Default is "flexskel.cc".
  32.     -{"-H"<header-skeleton>} Set filename of header skeleton. Default is "flexskel.h".
  33.     -{"-h"[<header>]} Set filename of header skeleton. Default is "lex.yy.h",  or <c_basename>.h if "-o"is used and there is no header name, ".c", ".cc", ".C", ".cpp", ".cxx"... options for output files are replaced by ".h" to generate the header name.
  34.     -{"-g"<includefilename>} change the filename that "flex++" put in the "#include" inside the code, when a separate header is generated. Useful when the parameter name of the header contain pathname information that may change.
  35. :SECTION "DECLARATIONS"
  36.     These are new declarations to put in the declaration section :
  37.     -{"\%name" <scanner_name>} Declare the name of this scanner. User for C++ class name, and to render many names unique. default is "lex". Must be given before "\%define", or never.
  38.     -{"\%define" <define_name> <content...>} Declare a macro symbol in header and code. The name of the symbol is "YY_"'<scanner_name>'"_"'<define_name>'. The content if given after, as with #define. Newline can be escaped as with #define. Many symbols are proposed for customisation. 
  39.     -{"\%header\{"} Like "\%\{", but include this text  in the header. End with "\%\}". When put in declaration section, the text is added before the definitions. It can be put at the begin of the second section so that the text is added after all definition in the header.
  40. :SECTION "DECLARATION DEFINE SYMBOLS"
  41.     These are the symbols you can define with "\%define" in declaration section, or that are already defined. Remind that they are replaced by a preprocessor "#define YY_"'<scanner_name>'"_"'<name>.
  42.     -{"FLEX_SCANNER"} Automaticaly defined  in the code. used for conditioanl code. it is effectively defined at the point of the "\%name" directive, or at the point of the "\%\%" between section 1 and 2.
  43.     -{"CHAR"} Automaticaly defined  in the code. Define the type of char used depending of the 8-bits flag ("unsigned char" if 8-bit, "char" if 7-bit). it is effectively defined at the point of the "\%name" directive, or at the point of the "\%\%" between section 1 and 2. You cannot use it before.
  44.     -{"FLEX_DEBUG"} Automaticaly defined  in the code if debug option "-d" set. Define the type of char used depending of the 8-bits flag ("unsigned char" if 8-bit, "char" if 7-bit). it is effectively defined at the point of the "\%name" directive, or at the point of the "\%\%" between section 1 and 2. You cannot use it before.
  45.     -{"DEBUG_FLAG"} The runtime debug flag name. Default is "yy_flex_debug". See "yy_flex_debug" in flex. Used only in debug mode.
  46.     -{"DEBUG_INIT"} The runtime debug flag initial value. Default is "1". See "yy_flex_debug" in flex.
  47.     -{"TEXT"} The scanned text string. default "yytext". See "yytext" in "flex".
  48.     -{"LENG"} The scanned text length. default "yyleng". See "yyleng" in "flex".
  49.     -{"IN"} The input file pointer. default "yyin". See "yyin" in "flex".
  50.     -{"OUT"} The input file pointer. default "yyout". See "yyout" in "flex".
  51.     -{"LEX"} The scanner function name. default "yylex". See "yylex" in "flex". Replace "#define YYDECL".
  52.     -{"LEX_RETURN"} The scanner function return type. default "int". See "yylex" in "flex". Replace "#define YYDECL".
  53.     -{"LEX_PARAM"} The scanner function parameter list. default "void", or empty un old-C. See "yylex" in "flex". Replace "#define YYDECL".
  54.     -{"LEX_PARAM_DEF"} The scanner function parameter declaration for old-C. Defined and used only in old-C. Default empty . See "yylex" in "flex". Replace "#define YYDECL". For example to pass an "int", named "x", "LEX_PARAM"
  55.  is set to "x", and "LEX_PARAM_DEF" to "int x ;".
  56.     -{"RESTART"} The restart function name. default "yyrestart". See "yyrestart" in "flex".
  57.     -{"SWITCH_TO_BUFFER"}
  58.     -{"LOAD_BUFFER_STATE"}
  59.     -{"CREATE_BUFFER"}
  60.     -{"DELETE_BUFFER"}
  61.     -{"INIT_BUFFER"} The buffer control functions names. defaults are "yy_switch_to_buffer", "yy_load_buffer_state", "yy_create_buffer", "yy_delete_buffer", "yy_init_buffer". See this functions in "flex".
  62.     These are only used if class is generated.
  63.     -{"CLASS"} The class name. default is the scanner name.
  64.     -{"INHERIT"} The inheritance list. Don't forget the ":" before, if not empty list.
  65.     -{"MEMBERS"} List of members to add to the class definition, before ending it.
  66.     -{"ECHO"} The scanner echo member function boby. Default to yy_echo. this function is called by the macro ECHO. See "ECHO" on "flex".
  67.     -{"INPUT"} The block input member function . This function is called inside the macro YY_INPUT. It read a block of text to be scanned. Default is to read "yyin". See "YY_INPUT".
  68.     -{"FATAL_ERROR"} The error message member function . This function is called inside the macro YY_FATAL_ERROR.  Default is to write the message to stderr and exit . See "YY_FATAL_ERROR".
  69.     -{"WRAP"} The wrap member function . This function is called inside the macro "yywrap()".  Default is to return 1 . See "yywrap()" in "flex".
  70.     -{"ECHO_PURE"}
  71.     -{"INPUT_PURE"}
  72.     -{"FATAL_ERROR_PURE"}
  73.     -{"WRAP_PURE"} Indicate that the corresponding member function is to be pure. It implys automatically the <function>"_NOCODE" symbol
  74.     -{"ECHO_NOCODE"}
  75.     -{"INPUT_NOCODE"}
  76.     -{"FATAL_ERROR_NOCODE"}
  77.     -{"WRAP_NOCODE"} Indicate that the corresponding member function is not to be defined in the generated code, but outside by yourself. Activated automaticaly by the <function>"_PURE" symbols.
  78.     -{"ECHO_CODE"}
  79.     -{"INPUT_CODE"}
  80.     -{"FATAL_ERROR_CODE"}
  81.     -{"WRAP_CODE"} Give the body code of the corresponding member function. default is to implement standard behaviour. Ignored if <function>"_PURE" or <function>"_NOCODE" are defined.
  82.     -{"CONSTRUCTOR_PARAM"} List of parameters of the constructor. Dont allows default value.
  83.     -{"CONSTRUCTOR_INIT"} List of initialisation befor constructor call. If not empty dont't forget the ":" before list of initialisation.
  84.     -{"CONSTRUCTOR_CODE"} Code added after internal initialisations in constructor.
  85. :SECTION "OBSOLETED FUNCTIONS"
  86.     -{"yyinput()"} In C++, the member function "yyinput()" is equivalent to "input()" that read one char. It is kept for compatibility with old flex behaviour, that replaced in C++ ,the function "input()" with "yyinput()" not to colide with stream library. Don't mismatch it with "yy_input(char  *buf, int &result, int max_size)" which read a bloc to be buffered.
  87. :SECTION "OBSOLETED PREPROCESSOR SYMBOLS"
  88.     if you use  new features, the folowing symbols should not be used, though they are proposed. Incoherence may arise if they are defined simultaneously with the new symbol.
  89.     -{"YYDECL"}In C only. Prefer "\%define LEX", "\%define LEX_RETURN", "\%define LEX_PARAM", "\%define LEX_PARAM_DEF". Totaly ignored with classes, or if you "\%define" one of these symbols, or the symbol "LEX_DEFINED", since it mean you use the new ways to redefine yylex declaration. Never use it if header are generated, since the declared function would be wrong.
  90.     -{"yy_new_buffer"}In C only. Prefer "\%define CREATE_BUFFER".
  91.     -{"YY_CHAR"} like with old "flex". You should better use the "\%define"'ed symbol "CHAR", or not use this yourself, since you know if you are 8 or 7-bit. Not defined in separate header.
  92.     -{"FLEX_DEBUG"} Like with old "flex". activate trace. prefer the automaticaly added "\%define DEBUG ". Defined if debug option "-d" set.
  93.     -{"FLEX_SCANNER"} like with old "flex". defined in the scanner itself .
  94.     -{"YY_END_TOK"} Like with old "flex". Indicate the value returned at end by yylex. Don't redefine it, since it is only  informative. Value is 0.
  95.  
  96. :SECTION "CONSERVED PREPROCESSOR SYMBOLS"
  97.     These symbols are kept, and cannot be defined elsewhere, since they control private parameters of the generated parser, or are actually unused. You can "#define" them to the value you need, or indirectly to the name of a "\%define" generated symbol if you want to be clean.     
  98.     -{"YY_READ_BUF_SIZE"}  Size of read buffer (8192). You must undefine it to redefine it after, like like with old "flex".
  99.     -{"YY_BUF_SIZE"}  Total size of read buffer ( YY_READ_BUF_SIZE *2 ). You must undefine it to redefine it after, except if defined by "cpp" , like with old "flex".
  100.     -{"yyterminate()"} like with old "flex". default return YY_NULL, that is 0. 
  101.     -{"YY_BREAK"} Like with old "flex". Don't use it, it is supported but dangerous.
  102.     -{"YY_NEW_FILE"} Action to continue scanning with the repopened file in yyin. like with old flex. Normally nor to be changed.
  103.     These are used only without classes, and you should redefine corresponding virtual function with classes, instead of the macros themselves.
  104.     -{"ECHO"} like with old "flex". With classes it is mapped to the virtual function yy_echo(), and you should not modify the macro itself. This name can be changed with "\%define ECHO".
  105.     -{"YY_INPUT"} like with old "flex". With classes it use the virtual function yy_input(), and you should not modify the macro itself. This name can be changed with "\%define INPUT".
  106.     -{"YY_FATAL_ERROR"} like with old "flex". With classes it is mapped to the virtual function yy_fatal_error(), and you should not modify the macro itself. This name can be changed with "\%define FATAL_ERROR".
  107.     -{"yywrap"} like with old "flex". With classes it is mapped to the virtual function yy_wrap(), and you should not modify the macro itself. This name can be changed with "\%define WRAP".
  108. :SECTION "OTHER ADDED PREPROCESSOR SYMBOLS"
  109.     -{"YY_USE_CLASS"} indicate that class will be produced. Default if C++.
  110. :SECTION "C++ CLASS GENERATED"
  111.     To simplify the notation, we note "\%SYMBOLNAME" the preprocessor symbol generated with a "\%define" of this name. In fact see the use of "\%define" for it's real name.
  112.     Note that there is sometime symbols that differ from only an underscore "_", like "yywrap" and "yy_wrap". They are much different. In this case "yy_wrap()" is a virtual member function, and "yywrap()" is a macro. 
  113.   :SSECTION "General Class declaration"
  114.     // Here is the declaration made in the header
  115.     class \%CLASS \%INHERIT
  116.     \{
  117.      private:/* data */
  118.     // Secret, don't use.
  119.      private: /* functions */
  120.      void yy_initialize();
  121.      int input();
  122.      int yyinput() \{return input();\};
  123.      void yyunput( \%CHAR  c, \%CHAR  *buf_ptr );
  124.     // Others are secret, don't use.
  125.      protected:/* non virtual */
  126.      YY_BUFFER_STATE yy_current_buffer;
  127.      void \%RESTART ( FILE *input_file );
  128.      void \%SWITCH_TO_BUFFER( YY_BUFFER_STATE new_buffer );
  129.      void \%LOAD_BUFFER_STATE( void );
  130.      YY_BUFFER_STATE \%CREATE_BUFFER( FILE *file, int size );
  131.      void \%DELETE_BUFFER( YY_BUFFER_STATE b );
  132.      void \%INIT_BUFFER( YY_BUFFER_STATE b, FILE *file );
  133.      protected: /* virtual */
  134.     // these 4 virtual function may be declared PURE (=0), with the symbols like \%ECHO_PURE,... 
  135.     // these 4 virtual function may not be defined in the generated code, with the symbol like \%ECHO_NOCODE,... 
  136.     // these 4 virtual function may be defined with another code, with the symbol like ECHO_CODE,... 
  137.      virtual void \%ECHO(); 
  138.     virtual int  \%INPUT(char  *buf,int &result,int max_size);
  139.      virtual void  \%FATAL_ERROR(char *msg);
  140.      virtual int  \%WRAP();
  141.      public:
  142.      \%CHAR  *\%TEXT;
  143.      int \%LENG;
  144.      FILE *\%IN, *\%OUT;
  145.      \%LEX_RETURN \%LEX ( \%LEX_PARAM);
  146.      \%CLASS(\%CONSTRUCTOR_PARAM) ;
  147.     #if \%DEBUG != 0
  148.      int \%DEBUG_FLAG;
  149.     #endif
  150.      public: /* added members */
  151.      \%MEMBERS 
  152.     \};
  153.     // this is the code for the virtual function 
  154.     // may be disabled with symbol like ECHO_PURE or ECHO_NOCODE
  155.      
  156.     void \%CLASS::\%ECHO() // echo the current token
  157.     \{\%ECHO_CODE\}
  158.     int  \%CLASS::\%INPUT(char * buffer,int &result,int max_size) // read a bloc of text
  159.     \{\%INPUT_CODE\}
  160.     void \%CLASS::\%FATAL_ERROR(char *msg) // print a fatal error
  161.     \{\%FATAL_ERROR_CODE\}
  162.     int  \%CLASS::\%WRAP() // decide if we must stop input, or continue
  163.     \{\%WRAP_CODE\}
  164.  
  165.   :SSECTION "Default Class declaration"
  166.     // Here is the default declaration made in the header when you \%define nothing
  167.     class lexer 
  168.     \{
  169.      private:/* data */
  170.     // Secret, don't use.
  171.      private: /* functions */
  172.      void yy_initialize();
  173.      int input();
  174.      int yyinput() \{return input();\};
  175.      void yyunput( unsigned char  c, unsigned char  *buf_ptr );
  176.     // Others are secret, don't use.
  177.      protected:/* non virtual */
  178.      YY_BUFFER_STATE yy_current_buffer;
  179.      void yyrestart ( FILE *input_file );
  180.      void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer );
  181.      void yy_load_buffer_state( void );
  182.      YY_BUFFER_STATE yy_create_buffer( FILE *file, int size );
  183.      void yy_delete_buffer( YY_BUFFER_STATE b );
  184.      void yy_init_buffer( YY_BUFFER_STATE b, FILE *file );
  185.      protected: /* virtual */
  186.      virtual void yy_echo(); 
  187.     virtual int  yy_input(char  *buf,int &result,int max_size);
  188.      virtual void  yy_fatal_error(char *msg);
  189.      virtual int  yy_wrap();
  190.      public:
  191.      unsigned char  *yytext;
  192.      int yyleng;
  193.      FILE *yyin, *yyout;
  194.      int yylex ( void);
  195.      lexer() ;
  196.     #if YY_lexer_DEBUG != 0
  197.      int yy_flex_debug;
  198.     #endif
  199.      public: /* added members */
  200.     \};
  201.     // this is the code for the virtual function 
  202.     void lexer::yy_echo() // echo the current token
  203.     \{fwrite( (char *) yytext, yyleng, 1, yyout );\}
  204.     int  lexer::yy_input(char * buffer,int &result,int max_size) // read a bloc of text
  205.     \{return result= fread(  buffer, 1,max_size, yyin );\}
  206.     void lexer::yy_fatal_error(char *msg) // print a fatal error
  207.     \{fputs( msg, stderr );putc( '\n', stderr );exit( 1 );\}
  208.     int  lexer::yy_wrap() // decide if we must stop input, or continue
  209.     \{return 1;\}
  210.  
  211. :SECTION "USAGE"
  212.     Should replace "flex", because it generate a far more customisable parser, with header, still beeing compatible.
  213.     You should always use the header facility.
  214.     Use it with "bison++" (same author).
  215. :SECTION "EXEMPLES"
  216.     flex++ use itself to generate it's scanner. It is full compatible with classic flex.
  217.     This man page has been produced through a parser made in C++ with this version of "flex++" and our version of "bison++" (same author).
  218. :SECTION "FILES"
  219.     -{"flexskel.cc"} main skeleton.
  220.     -{"flexskel.h"} header skeleton.
  221. :SECTION "ENVIRONNEMENT"
  222. :SECTION "DIAGNOSTICS"
  223. :SECTION "SEE ALSO"
  224.     "flex"(1),"flexdoc"(1),"bison++"(1).
  225. :SECTION "DOCUMENTATION"
  226. :SECTION "BUGS"
  227.     Tell us more !
  228.     Because "flex++" put a "#include" of the  generated header in the generated code, the header is necessary, and must be reachable by "cpp". use the "-g" option to change the pathname of this file. Problems arise when the header is generated in another directory, or is moved.
  229.     Parameters are richer than before, and nothing is removed. POSIX compliance can be enforced by not using extensions. If you want to forbide them, there is a good job for you.
  230.     The grammar file scanner now support any EndOfLine sequence (CR, LF, CRLF), event inside the same file. So dont worry if it accept files from MSDOS, MacIntosh, and UNIX, with neither any message nor any problem. This is not a bug.
  231.     The automatic "\%define" symbols "FLEX_DEBUG", "FLEX_SCANNER" and "CHAR", are added only after the "\%name" directive, or at the "\%\%" between section 1 and 2. You cannot use them before, neither in "\%header\{", nor "\%\{". A good practice is to always give a name, and to give it at first. The old "#define" symbols are still defined at top for backward compatibility.
  232. :SECTION "FUTUR WORKS"
  233.     tell us !
  234.     POSIX compliance. is'nt it good now ?
  235.  
  236. :SECTION "INSTALLATION"
  237.     With this install the executable is named flex++. rename it flex if you want, because it could replace "flex".
  238. :SECTION "TESTS"
  239. :SECTION "AUTHORS"
  240.     Alain Coδtmeur (coetmeur@icdc.fr), R&D department (RDT) , Informatique-CDC, France.
  241. :SECTION "RESTRICTIONS"
  242.     The words 'we', and 'us' mean the author and colleages, not GNU. We don't have contacted GNU about this, nowaday. If you're in GNU, we are ready to   propose it to you, and you may tell us what you think about.
  243.     Based on GNU version 2.3.7 of flex. Modified by the author.
  244.